//
//  WMyController.m
//  xmpp即时通信
//
//  Created by student on 16/1/23.
//  Copyright © 2016年 123. All rights reserved.
//

#import "WMyController.h"
#import "AppDelegate.h"
#import "loginViewController.h"

@interface WMyController ()

@end

@implementation WMyController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"注销" style:UIBarButtonItemStylePlain target:self action:@selector(logout)];
}

- (void)logout
{
    AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
    [appDelegate disConnectToServer];
    
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    ViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"login"];
    
    appDelegate.window.rootViewController = viewController;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
